package calao.contact;

import calao.contact.client.PostAddress;
import calao.storage.DataBinding;
import calao.storage.DataReader;
import calao.storage.DataWriter;
import calao.storage.UnknownBindingException;

public class PostAddressBinding 
extends DataBinding<PostAddress>
{

	public final static String NAME = "calao.contact.PostAddress"; 

	public PostAddressBinding() {
		super(PostAddress.class, NAME);
	}

	@Override
	public PostAddress readObject(DataReader reader, int version)
	throws UnknownBindingException
	{
		PostAddress object = new PostAddress();
		object.setAddress(reader.readString());
		object.setTown(reader.readString());
		object.setPostCode(reader.readString());
		object.setCountryCode(reader.readString());
		return object;
	}

	@Override
	public void write(DataWriter writer, PostAddress object)
	{
		writer.write(object.getAddress());
		writer.write(object.getTown());
		writer.write(object.getPostCode());
		writer.write(object.getCountryCode());
	}

}
